package com.seanchenxi.gwt.wordpress.xmlrpc.service.local.impl;

import com.seanchenxi.gwt.wordpress.xmlrpc.service.WordPressServiceAsync;
import com.seanchenxi.gwt.wordpress.xmlrpc.service.impl.WordPressServiceAsyncImpl;

/**
 * The Class WordPressLocalServiceAsyncWrapper.
 */
abstract class WordPressLocalServiceAsyncWrapper extends
		LocalServiceWrapper {

	WordPressServiceAsync wordPressService = null;

	/**
	 * Instantiates a new word press local service async wrapper.
	 * 
	 * @param url
	 *            the xmlrpc's url
	 * @param wpUserName
	 *            the wordpress's user name
	 * @param wpPassword
	 *            the wordpress's password
	 */
	public WordPressLocalServiceAsyncWrapper(String url, String wpUserName,
			String wpPassword) {

		assert (url != null && url.length() > 7);
		assert (wpUserName != null && wpUserName.trim().length() > 0
				&& wpPassword != null && wpPassword.trim().length() > 0);

		wordPressService = new WordPressServiceAsyncImpl(url);

		assert (wordPressService != null);

		setWpUser(wpUserName, wpPassword);
	}

	protected WordPressServiceAsync getWordPressService() {
		return (WordPressServiceAsync) wordPressService;
	}
}
